<%@codepage="65001"%>
<%session.codepage="65001"%>
<!-- #include virtual=/inc/dbConn.asp -->
<!-- #include virtual=/inc/function.asp -->
<!-- #include virtual=/inc/action.header.inc.asp -->

<%
	'## 파라미터 변수 선언부
	prdNm		= Request("findPrdNm")
	keyset	= Request("findKeyset")
	startDt		= Request("findStartDt")
	endDt		= Request("findEndDt")

	If goodsCnt = "" Then goodsCnt = 0 End If 

	SQLTitle = "-- ■■■■ 가공(2팀) 정보 그리드 List up ■■■■"
	
	'## 검색조건에 따른 조건절 만들기 
	If prdNm <> "" Then 
		addSql = " A.prdNm LIKE '%" & prdNm & "%' "
	End If 
	If keyset = "" Then
		keyset = "workDt"
	End If 
	If startDt <> "" Then 
		If addSql <> "" Then addSql = addSql & " AND "
		addSql = addSql & " A." & keyset & " >= '" & startDt & "' "
	End If 
	If endDt <> "" Then 
		If addSql <> "" Then addSql = addSql & " AND "
		addSql = addSql & " A." & keyset & " <= '" & endDt & "' "
	End If 

	If addSql <> "" Then 
		addSql = " WHERE " & addSql 
	End If 

	SQL = "SELECT A.lotSeq,  A.prdNm, A.workDt, A.outDt, A.qty, A.flag, B.company FROM tblExtraOrder A " & _
			" LEFT JOIN tblCompany B ON A.compCd=B.compCd " & addSql & _
			" ORDER BY A.workDt DESC, A.prdNm" 

	If xMode="debug" Then 
		Call showDebug(SQLTitle,SQL) 
	End If 

	Set Rs=Server.CreateObject("ADODB.RecordSet")
	Rs.open SQL, DbCon, 1
	
	Response.write "<ExtraOrders>" & vbcrlf

	If Rs.eof Or Rs.bof Then 
	Else 
		Do Until Rs.eof Or Rs.bof
		
			Response.write "	<OrderList>" & vbcrlf
				Call mkXMLNode("lotSeq", rs("lotSeq"), 2)
				Call mkXMLNode("prdNm", rs("prdNm"), 2)
				Call mkXMLNode("workDt", rs("workDt"), 2)
				Call mkXMLNode("outDt", rs("outDt"), 2)
				Call mkXMLNode("qty", FormatNumber(rs("qty"),0), 2)
				Call mkXMLNode("company", rs("company"), 2)
				Call mkXMLNode("flag", Rs("flag"), 2)
			Response.write "	</OrderList>" & vbcrlf

		Rs.movenext
		Loop 
	End If
	Response.write "</ExtraOrders>" & vbcrlf
'	Call rsWithXML("Save OK!")
%>